package it.sources.controller;

import it.sources.template.AiTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController

public class Ai {
    @Autowired
    private AiTemplate aiTemplate;
    @RequestMapping("/ai/chat/{text}")
    public String chat(@PathVariable String text) {
        try {
            return aiTemplate.chat(text);
        } catch (IOException e) {
            e.printStackTrace();
            return "滚你🐎的";
        }
    }
}
